package com.service.dao.enums;

import lombok.Getter;
import org.springframework.lang.Nullable;

public class BannerEnum {

    public enum BizType{
        home(1,"home"),
        gift_mall(2,"gift_mall"),
        point_mall(3,"point_mall"),
        hash_rate_mall(4,"hash_rate_mall"),
        ;

        @Getter
        private Integer code;
        @Getter
        private String name;

        BizType(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static BizType valueOf(int statusCode) {
            BizType status = resolve(statusCode);
            if (status == null) {
                throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
            }
            return status;
        }

        @Nullable
        public static BizType resolve(int statusCode) {
            for (BizType status : values()) {
                if (status.code == statusCode) {
                    return status;
                }
            }
            return null;
        }
    }



}
